import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import {
  AdvertiserEverydayCostVO,
  AdvertiserEverydayCostForm,
  AdvertiserEverydayCostQuery,
  HoursTotalCost
} from '@/api/oce/advertiserEverydayCost/types';

/**
 * 查询巨量广告主每日消耗记录列表
 * @param query
 * @returns {*}
 */

export const listAdvertiserEverydayCost = (query?: AdvertiserEverydayCostQuery): AxiosPromise<AdvertiserEverydayCostVO[]> => {
  return request({
    url: '/oce/advertiserEverydayCost/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询巨量广告主每日消耗记录详细
 * @param advertiserCostId
 */
export const getAdvertiserEverydayCost = (advertiserCostId: string | number): AxiosPromise<AdvertiserEverydayCostVO> => {
  return request({
    url: '/oce/advertiserEverydayCost/' + advertiserCostId,
    method: 'get'
  });
};

/**
 * 新增巨量广告主每日消耗记录
 * @param data
 */
export const addAdvertiserEverydayCost = (data: AdvertiserEverydayCostForm) => {
  return request({
    url: '/oce/advertiserEverydayCost',
    method: 'post',
    data: data
  });
};

/**
 * 修改巨量广告主每日消耗记录
 * @param data
 */
export const updateAdvertiserEverydayCost = (data: AdvertiserEverydayCostForm) => {
  return request({
    url: '/oce/advertiserEverydayCost',
    method: 'put',
    data: data
  });
};

/**
 * 删除巨量广告主每日消耗记录
 * @param advertiserCostId
 */
export const delAdvertiserEverydayCost = (advertiserCostId: string | number | Array<string | number>) => {
  return request({
    url: '/oce/advertiserEverydayCost/' + advertiserCostId,
    method: 'delete'
  });
};

/**
 * 总时速列表
 * @param query
 */
export const getOceEverydayHoursTotalCost = (query: AdvertiserEverydayCostQuery) => {
  return request({
    url: '/oce/everydayCostHours/getOceEverydayHoursTotalCost',
    method: 'get',
    params: query
  });
};

/**
 * 小时时速列表
 * @param query
 */
export const getHoursCostPage = (query: HoursTotalCost) => {
  return request({
    url: '/oce/everydayCostHours/getHoursCostPage',
    method: 'get',
    params: query
  });
};

/**
 * 总消耗时段充值趋势图 - 汇总
 * @param query
 */
export const getTotalHoursBlockPayAmount = (query: AdvertiserEverydayCostQuery) => {
  return request({
    url: '/oce/everydayCostHours/getTotalHoursBlockPayAmount',
    method: 'get',
    params: query
  });
};

/**
 * 时段充值趋势图  -- 列表中数据
 * @param query
 */
export const getHoursBlockPayAmount = (query: HoursTotalCost) => {
  return request({
    url: '/oce/everydayCostHours/getHoursBlockPayAmount',
    method: 'get',
    params: query
  });
};
